package com.ccc.boot.system.service;

import com.ccc.boot.system.pojo.FileParam;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 文件操作
 *
 * @author superC
 * @version 0.1.0
 * @date 2022/4/7
 */

public interface SysFileService {

    Long upload(MultipartFile file) throws IOException;

    Long upload2DB(MultipartFile file) throws IOException;

    boolean delete(Long fileId);

    boolean deleteFile(FileParam fileParam);

    void getFile(Long fileId, HttpServletResponse response);

    /**
     * 获取文件的base64编码,
     *
     * @date 2022/4/7 16:29
     * @param fileId
     * @return {@link String} 使用base64直接把文件编码成字符串
     * @author superC
     */
    String getFile(Long fileId);

    /**
     * 获取图片的base64编码,
     *
     * @date 2022/4/7 16:29
     * @param fileId
     * @return {@link String} 使用base64直接把图片编码成字符串
     * @author superC
     */
    String getImage(Long fileId);

}